package com.example.provider.controller;

import com.example.common.entity.Demand;
import com.example.common.entity.Employ;
import com.example.common.entity.WorkRoom;
import com.example.provider.service.SearchService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.elasticsearch.index.query.QueryStringQueryBuilder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

@Api(value="搜索controller",tags={"用户搜索接口"})
@RestController
@RequestMapping("/search")
public class SearchController {
    @Autowired
    private SearchService searchService;

    /**
     * 根据标签搜索项目(需求)
     * @param lable
     * @return
     */
    @GetMapping("/demand")
    public List<Demand> SearchByLable(String lable) throws IOException {
        return searchService.SearchByLable(lable);
    }

    @ApiOperation("根据标签搜索工作室")
    @GetMapping("/workroomByLable")
    public List<WorkRoom> SearchWorkroomByLable(String lable) {
        return searchService.SearchWorkroomByLable(lable);
    }

    @ApiOperation("根据名称搜索工作室")
    @GetMapping("/workroomByName")
    public List<WorkRoom> SearchWorkroomByName(String name) {
        return searchService.SearchWorkroomByName(name);
    }
}
